package cn.yunbamboos.mybatis.mapping.methods.dynamicQuery;

import cn.yunbamboos.mybatis.mapping.methods.BaseDynamicQueryMethod;
import cn.yunbamboos.mybatis.metadata.TableInfo;
import org.apache.ibatis.scripting.xmltags.StaticTextSqlNode;
import org.apache.ibatis.session.Configuration;

import java.util.Optional;

public class QueryForPage extends BaseDynamicQueryMethod {

    public QueryForPage(Configuration configuration, TableInfo tableInfo) {
        super("queryForPage", configuration, tableInfo);
    }

    @Override
    protected Optional<StaticTextSqlNode> getPageSqlNode() {
        StaticTextSqlNode sqlNode = new StaticTextSqlNode(" limit #{page.offset}, #{page.size} ");
        return Optional.of(sqlNode);
    }

}
